
def bulk(self):
    print('bulk')

class Dog(object):

    def __init__(self, name):
        self.name = name

    def eat(self):
        print('%s在吃东西' % self.name)

d = Dog('liuqi')
choice = input('--->').strip()
if hasattr(d, choice):
    getattr(d, choice)

else:
    setattr(d, choice, bulk)
    func = getattr(d, choice)
    func(d)

# print(d.name)